grails.gorm.default.mapping = {
	cache true
}
grails.gorm.default.constraints = {
	'*'(nullable: true)
}
grails.gorm.failOnError = true

grails.databinding.convertEmptyStringsToNull = false
grails.databinding.trimStrings = true


grails.converters.json.default.deep = true  //最好是配合默认使用deep。<span style="color:#ff0000;">注：如果在类中使用JSON.use("deep")时，会导致JSON.registerObjectMarshaller失效，这个不知道算不算Grails的BUG</span>
grails.converters.default.circular.reference.behaviour = "INSERT_NULL"

// Added by the Spring Security Core plugin:
grails.plugin.springsecurity.userLookup.userDomainClassName = 'middol.auth.User'
grails.plugin.springsecurity.userLookup.authorityJoinClassName = 'middol.auth.UserAuthority'
grails.plugin.springsecurity.authority.className = 'middol.auth.Authority'
grails.plugin.springsecurity.authority.groupAuthorityNameField = 'authorities'
grails.plugin.springsecurity.useRoleGroups = true
grails.plugin.springsecurity.requestMap.className = 'middol.auth.Requestmap'
grails.plugin.springsecurity.securityConfigType = 'Requestmap'
grails.plugin.springsecurity.controllerAnnotations.staticRules = [
	[pattern: '/',               access: ['permitAll']],
	[pattern: '/error',          access: ['permitAll']],
	[pattern: '/index',          access: ['permitAll']],
	[pattern: '/index.gsp',      access: ['permitAll']],
	[pattern: '/shutdown',       access: ['permitAll']],
	[pattern: '/assets/**',      access: ['permitAll']],
	[pattern: '/**/js/**',       access: ['permitAll']],
	[pattern: '/**/css/**',      access: ['permitAll']],
	[pattern: '/**/images/**',   access: ['permitAll']],
	[pattern: '/**/favicon.ico', access: ['permitAll']]
]

grails.plugin.springsecurity.filterChain.chainMap = [
	[pattern: '/assets/**',      filters: 'none'],
	[pattern: '/**/js/**',       filters: 'none'],
	[pattern: '/**/css/**',      filters: 'none'],
	[pattern: '/**/images/**',   filters: 'none'],
	[pattern: '/**/favicon.ico', filters: 'none'],
	[pattern: '/api/**', filters: 'JOINED_FILTERS,-anonymousAuthenticationFilter,-exceptionTranslationFilter,-authenticationProcessingFilter,-securityContextPersistenceFilter'],
	[pattern: '/webService/**', filters: 'JOINED_FILTERS,-anonymousAuthenticationFilter,-exceptionTranslationFilter,-authenticationProcessingFilter,-securityContextPersistenceFilter'],
	[pattern: '/**',             filters: 'JOINED_FILTERS,-restTokenValidationFilter,-restExceptionTranslationFilter']
]

grails.plugin.springsecurity.logout.postOnly = false


// Added by the Audit-Logging plugin:
//grails.plugin.auditLog.auditDomainClassName = 'middol.sys.OperationLog'

grails {
	plugin {
		auditLog {
			auditDomainClassName = 'middol.sys.OperationLog'
			verbose = true
			failOnError = true
			excluded = ['version', 'lastUpdated', 'lastUpdatedBy', 'createdBy', 'dateCreated']
			mask = ['password']
			logIds = true
			stampEnabled = true
//			ignoreEvents = [grails.plugins.orm.auditable.AuditEventType.INSERT]
			verboseEvents = [middolauditlog.AuditEventType.UPDATE, middolauditlog.AuditEventType.INSERT, middolauditlog.AuditEventType.DELETE]
//			verboseEvents = [[enumType: "grails.plugins.orm.auditable.AuditEventType",name: "UPDATE"], [enumType: "grails.plugins.orm.auditable.AuditEventType",name: "DELETE"]]
		}
	}
}

